package com.demo2do.fms.entity.vehicle.trailer;

import org.apache.commons.lang3.StringUtils;

import com.demo2do.core.utils.Alias;

/**
 * 挂车类型
 * 
 * @author Wy
 */
@Alias("TrailerType")
public enum TrailerType {
    
    /** 开放式  */
    EDITING("open", "开放式"),
    
    /** 半封闭  */
    HALFCLOSED("half-closed", "半封闭"),
    
    /** 全封闭 */
    CLOSED("closed", "全封闭"),
    
    /** 飞翼挂 */
    FLYWING("fly-wing", "飞翼挂"),
    
    /** 平板挂 */
    FLAT("flat", "平板挂"),
    
    /** 高栏挂 */
    HURDLE("hurdle", "高栏挂");
    
    private String alias;
    
    private String description;

    /**
     * @param alias
     * @param description
     */
    private TrailerType(String alias , String description) {
        this.alias = alias;
        this.description = description;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static TrailerType aliasOf(String alias){
        
        for(TrailerType auditStatus : TrailerType.values()){
            if(auditStatus.getAlias().equals(alias)){
                
                return auditStatus;
            }
        }
        return null;
    }
    
    /**
     * @param description
     * @return
     */
    public static TrailerType descriptionOf(String description) {
        
        for(TrailerType auditStatus : TrailerType.values()){
            if(StringUtils.equals(auditStatus.getDescription(), description)) {
                return auditStatus;
            }
        }
        return null;
    }
    
    /**
     * @return  alias
     */
    public String getAlias() {
        return alias;
    }
    
    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

}
